<?php
require_once("Database.php");
require_once("DBConfig.php");
require_once("User.php");
require_once("RemoveView.php");

class RemoveModel{
	
	private $m_db = NULL;
	
	public function __construct(Database $db){
		$this->m_db = $db;
	}

	public function RemoveList(){

				
				$dataarray = new UserArray();
				$dataarray = $this->m_db->SelectUsers();
				
				if(count($dataarray->get()) > 0){
					$removeview = new RemoveView();
					
					return $removeview->RemoveList($dataarray->get());
				}
				
			return false;
	}
	public function RemoveUser($userid){
			if($this->m_db->FindUser($userid) == 1){
					
				if(!$this->m_db->DeleteUser($userid)){
					return FALSE;
				}
							
				return TRUE;
				
			}
			else{
					return FALSE;
			}
			
			return TRUE;
		
	}
	
	function test(Database $db){
		/*
		 * Trying to remove users - works.
		if(!$this->RemoveUser('Rainbow', $db)){
			echo "Borked";
			return false;
		}*/
		
					return true;
	}
	

}
?>